﻿using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using Tradukisto.Engine.ResourceProviders;

namespace Tradukisto.Engine.Helpers
{
    public static class LinkHelper
    {
        public static MvcHtmlString LocalizableLink(this HtmlHelper helper, string name, string action, string controller)
        {
            var value = LocalizationProvider.Current.GetString(name);
            var temp = HtmlHelper.GenerateLink(helper.ViewContext.RequestContext, helper.RouteCollection, value, null, action, controller, null, null);
            return new MvcHtmlString(temp.ToString());
        }

        public static MvcHtmlString LocalizableLink(this AjaxHelper helper, string name, string action, string controller, AjaxOptions options, object routValues = null, object htmlAttributes = null)
        {
            var value = LocalizationProvider.Current.GetString(name);

            var ret = AjaxExtensions.ActionLink(helper, value, action, routValues, options, htmlAttributes);

            return ret;
        }
    }
}
